namespace Example
{
    using System.Net;
    using Example.Properties;
    using SimpleWebServices.Data;
    using SimpleWebServices.Net;
    using SimpleWebServices.Web;
    using SimpleWebServices.Web.UI.Html.Elements;
    using Xunit;

    public sealed class NotFoundFacts
    {
        private static readonly Resource _resource = new GenericResource
        {
            Title = "We are sorry, the page you requested cannot be found",
            Metadata =
            {
                new Meta { Name = "description", Content = "The page you requested cannot be found." },
                new Meta { Name = "DC.description", Content = "The page you requested cannot be found." },
                new Meta { Name = "robots", Content = "NOFOLLOW,INDEX" }
            }
        }
        .ApplyDefaultValues<GenericResource>();

        [Fact]
        public void Get_HtmlRepresentation()
        {
            Assert.True(HttpExpectations.New("http://example.simplewebservices.org/not-found-" + Token.New())
                .AcceptAnyContent()
                .AcceptAnyLanguage()
                .Cookieless()
                .Get()
                .Is(HttpStatusCode.NotFound)
                .HasCacheControlNone()
                .HasContentLanguageOfEnglish()
                .HasContentMD5()
                .ResponseIsTextHtml(_resource)
                .HasStyleSheetLink(Settings.Default.Stylesheet)
                .HasRobotsTag("NOFOLLOW,INDEX")
                .Evaluate<double>(1, Analytics.Xpath)
                .Evaluate<double>(1, "count(//img[@id='logo'])")
                .Evaluate<double>(1, "count(//div[@id='search-widget'])")
                .HasNoCookies()
                .Result);
        }
    }
}